home *** CD-ROM | disk | FTP | other *** search
- Path: news.wyoming.com!usenet
- From: dcromley@wyoming.com (Dave Cromley)
- Newsgroups: comp.lang.c++
- Subject: Re: Class problem
- Date: 28 Feb 1996 04:02:33 GMT
- Organization: wyoming.com LLC
- Message-ID: <4h0k4p$isp@horn.wyoming.com>
- References: <4gv6j2$klv@news-e2b.gnn.com>
- NNTP-Posting-Host: cys-cap-9.wyoming.com
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.2
-
- Pam wrote:
- >..I use Borland C++ ver. 3.1. It keeps giving me an error saying
- "Illegal Structure Operation" on these two lines:
- > cin >> addr.zip;
- > cin >> addr.phone;
- >
- >Both of these fields are listed within my address class. I have it
- >listed as:
- > class addr_data:public name_data
- > {
- > public:
- > char street[25];
- > char city[15];
- > char state[3];
- > int zip[11];
- > int phone[10];
- > }addr;
-
- My Borland C++4.5 doesn't give that, but still, I don't think this
- is what you want.
- 'char street[25]' defines an array of 25 characters, a string that
- is what you want.
- 'int zip[11]' ddefines an array of 11 integers, which isn't what
- you want.
- If an int could hold 11 digits, then it would be 'int zip'.
- Even a long int won't hold that.
- So you probably want 'char zip[11]'.
-
- Dave C.
-
-